<?php 

class W3a extends CI_Controller{
	
	
	function __construct(){
		parent::__construct();
		$this->load->model('w3a_model');	
		$this->load->helper('url');
		$this->load->library('Page_smart');

	}

	
	function index(){
		$w3a_manager = $this->w3a_model->get_manager();
		$config['page']=$this->uri->segment(3); 
		$config['rows']=$this->w3a_model->get_all(); 
		$config['base_url']=site_url('w3a/index/');
		$page_rst=$this->page_smart->page_do($config);
		$data['art_list']=$this->w3a_model->get_list($page_rst['select_from'],$page_rst['select_limit']);
		$data['page_list']=$page_rst['pagenav'];
		$data['w3a_manager'] = $w3a_manager;
		$data['right_news'] = $this->w3a_model->get_new();
		//$this->load->view('category',$data);
		$this->load->view('index',$data);
	}
    function article(){
        $id = intval($this->uri->segment(3));
        $row=$this->w3a_model->get_article_content($id);
        $data['rows'] = $row[0];
    	$this->load->view('article',$data);
    }
	
	function homepage(){
        //网站信息数据
        $row=$this->w3a_model->get_manager();
        $data['row']=$row[0];
        //文章类别
        $data['art_cate'] = $this->w3a_model->get_category_list();
		$this->load->view('homepage',$data);
	}
	
	function article_list(){
        $cid = intval($this->uri->segment(3));
        $data['article'] = $this->w3a_model->get_list($cid);
		
		$this->load->view('article_list',$data);
	}

    function register(){
    	$this->load->view('register');
    }

    function login(){
    	$this->load->view('login');
    }


}